<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="./js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<link href="${pageContext.request.contextPath}/css/Style.css"
	rel="stylesheet" type="text/css" />
<script language="javascript" src="${path}js/public.js"></script>
<script type="text/javascript">
	function addUser() {
		document.Form1.action = "userAction_add.do";
	}
	function queryGoods(){
		var goodsName=$("#goodsName").val();
		var spreadTypeId=$("#spreadTypeId").val();
		var goodsTypeId=$("#goodsTypeId").val();
		alert(goodsName);
		$.ajax({
			   type: "POST",
			   url: getPath()+"goods/queryGoods.do",
			   data:{"goodsName":goodsName,"spreadTypeId":spreadTypeId,"goodsTypeId":goodsTypeId},
			   success: function(data, textStatus){
				   var content=eval('('+data+')');
				   alert(data);
			   },
			   error:function(XMLHttpRequest, textStatus, errorThrown){
				   alert(errorThrown);
				 }
			});	
		}
</script>
<style type="text/css">
.tdTest {
	background-color: #f5fafe;
}

.tdInput {
	background-color: #ffffff
}

body {
	background-color: #dfecf6;
}

img {
	width: 100px;
	height: 100px;
}
/**  **/
table.imagetable {
	width:100%;
	font-family: verdana,arial,sans-serif;
	font-size:15px;
	color:#333333;
	border-width: 1px;
	border-color: #b2d6ef;
	border-collapse: collapse;
}
table.imagetable th {
	background:#fafafa ;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}
table.imagetable td {
	background:##b2d6ef ;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #999999;
}

</style>
</HEAD>
<body>
<center>
<table style="width: 90%">	
	<tr>
	<th colspan="4" align="left" style="background-color: #dfecf6;">查询条件</th>
	</tr>
	<tr>
		<td class="tdTest"  align="right">商品名称：</td>
		<td class="tdTest" colspan="3" align="left">
		<input type="text"	name="goodsName" style="width: 350px;" value="<s:property value='goodsName'/>">
		</td>
	</tr>
	<tr>
		<td class="tdTest"  align="right">推广类别：</td>
		<td class="tdTest" align="left">
		<select name="spreadTypeId">
			<option value="">请选择</option>
			<option value="1">活动推广</option>		
			<option value="2">店铺推广</option>
			<option value="3">商品推广</option>
		</select></td>
		<td class="tdTest" align="right">商品类别：</td>
		<td class="tdInput" align="left">
		<select name="goodsTypeId">
		<option value="">请选择</option>			 
			<option value="1">衣服</option>
			<option value="2">数码</option>
			<option value="3">医药</option>
		</select>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="right"><input type="button" value="查询"
			onclick="queryGoods()"></td>
		<td colspan="2" align="left"><input type="reset" value="重置"></td>

	</tr>
</table>

</center>
<table class="imagetable"> 
	<tr>
		<th>商品图片</th>
		<th>商品名称</th>
		<th>商品添加者</th>
		<th>商品添加时间</th>
		<th>商品类型</th>
		<th>浏览次数</th>
		<th>备注</th>
		<th>操作</th>
	</tr>
	<s:if test="listGoods!=null">
		<s:iterator value="listGoods">
			<tr>

				<td><a href="<s:property value='goodsUrl'/>" target="_blank"><img
					src="<s:property value='goodsImgUrl'/>"></a></td>
				<td style="width: 30%;"><a
					href="<s:property value='goodsUrl'/>" target="_blank"><s:property
					value="goodsName" /></a></td>
				<td style="width: 10%;"><s:property value="userId" /></td>
				<td style="width: 10%;"><s:property value="createDate" /></td>
				<td style="width: 10%;"><s:property value="goodsTypeId" /></td>
				<td style="width: 10%;"><s:property value="goodsViewsCount" />
				</td>
				<td style="width: 10%;"><s:property value="other" /></td>

				<s:if test="%{#session.user!=null}">
					<td style="width: 20%;"><s:a action="goods_updateUI.do"
						namespace="/goods">
						<s:param name="goods.id">${id}</s:param>修改</s:a> &nbsp;&nbsp; <s:a
						action="goods_delete.do" namespace="/goods" onclick="deleteGoods()">
						<s:param name="goods.id">${id}</s:param>删除</s:a></td>
				</s:if>
			</tr>
		</s:iterator>

	</s:if>
	<s:if test="listGoods==null">
		<tr>

			<td colspan="10" align="center">抱歉！！没有查到符合条件的商品。</td>
		</tr>
	</s:if>

</table>
</body>
</HTML>
